package cn.xopencode.securityservice.dal.mysql.mapper.suggest;

import cn.xopencode.common.framework.vo.SortingField;
import cn.xopencode.mybatis.core.query.QueryWrapperX;
import cn.xopencode.mybatis.core.util.PageUtil;
import cn.xopencode.securityservice.dal.mysql.dataobject.suggest.SuggestDO;
import cn.xopencode.securityservice.rpc.suggest.dto.SuggestPageReqDTO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.List;

@Repository
public interface SuggestMapper extends BaseMapper<SuggestDO> {
    default IPage<SuggestDO> selectPage(SuggestPageReqDTO pageReqDTO) {
        return selectPage(PageUtil.build(pageReqDTO, (Collection<SortingField>) pageReqDTO.getSuggestTime()),
                new QueryWrapperX<SuggestDO>().eqIfPresent("suggest_time", pageReqDTO.getSuggestTime()));
    }
}


